<%@ include file="/common/taglibs.jsp"%>
<%@ page pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<script type="text/javascript" src="${jquery}/jquery.js"></script>
		<script type="text/javascript" src="${jquery}/jquery.validate.js"></script>
		<script type="text/javascript" src="${jquery}/jquery.form.js"></script>
		<script type="text/javascript" src="${jquery}/messages_cn.js"></script>
		<script type="text/javascript" src="${easyui}/jquery.easyui.min.js"></script>
		<link rel="stylesheet" type="text/css"
			href="${easyui}/themes/icon.css">
		<link rel="stylesheet" type="text/css"
			href="${easyui}/themes/default/easyui.css">
		<link href="${app}/hnjz.css" rel="stylesheet" type="text/css">

		<script type="text/javascript"
			src="${colorbox}/jquery.colorbox-min.js"></script>
		<link rel="stylesheet" type="text/css" href="${colorbox}/colorbox2.css">
	</HEAD>

	<body>
		<div style="padding: 20px;">
			<form id="myform" name="myform" method="post" action="saveUser.json">
			<table width = "80%" border="0" align="center" cellpadding="0"
					cellspacing="0" class="formtable">
				<input type="hidden" value="${userForm.id}" id="id" name="id">
				<div id="neirong" style="padding: 5px;">
					<tr>
						<th>
							<span class="mark">*</span>姓名：
						</th>
						<td>
							<input class="i-text" type="text" id="name" name="name"
							value="${userForm.name}" />
						</td>
					</tr>
					<tr>
						<th>
							<span class="mark">*</span>登录名：
						</th>
						<td>
							<input class="i-text" type="text" value="${userForm.username}"
							id="username" name="username" />
						</td>
					</tr>
					<tr>
						<th>
							角色：
						</th>
						<td>
							<input class="i-text" type="text" value="${userForm.jiece}"
							id="jiece" name="jiece" />
						</td>
					</tr>
					<tr>
						<th>
							手机号：
						</th>
						<td>
							<input class="i-text" type="text"  maxlength="11" value="${userForm.shoujihao}"
							id="shoujihao" name="shoujihao" />
						</td>
					</tr>
					<tr>
						<th>
							工作手机号：
						</th>
						<td>
							<input class="i-text" type="text" maxlength="11" value="${userForm.shouji2}"
							id="shouji2" name="shouji2" />
						</td>
					</tr>
					<tr>
						<th>
							是否管理员：
						</th>
						<td>
							<input type="checkBox" id="issys" name="issys"
							<c:if test="${fn:trim(userForm.issys) eq '1'}" >checked</c:if> />
						</td>
					</tr>
					<tr>
						<td align="center" colspan="2">
							<span class="btn btn-ok"> <input id="userBtn" type="submit" value="提交">
							</span>&nbsp;
							<a href="#" id="J-from-reset">重置</a>&nbsp;
							<a href="#" id="J-pass-reset">重置密码为6个8</a>
						</td>
					</tr>
				</div>
				</table>
			</form>
		</div>
	</body>
</HTML>
<SCRIPT LANGUAGE="JavaScript">
function setOrgInfo(id,name) {
    $('#gxOrg').val(id)
    $('#gxOrgName').val(name)
    $('#gxOrgName').focus();
    jQuery().colorbox.close();
}
var lastRowIndex;
$(document).ready(function(){
    $("#selectParent").colorbox({iframe:true,width:"300", height:"400",href:"orgPubQuery.htm?id=${userForm.gxOrg}"});
	$("#J-from-reset").click(function(){
	   $("#myform").form('reset');
	});
	$("#J-pass-reset").click(function(){
	   		$.ajax({
				  url: "resetPas.json?id=${userForm.id}",
				  success:function(data){
						 $.messager.alert('重置密码:',data.msg);
				  }
			});
	});
	$('#jiece').combobox({
		url:'queryAllRole.json',
		valueField:'id',
		textField:'name'
	});
   	//表单校验
    $("#myform").validate(
    {
          errorClass: "error",
          submitHandler:function(form){
    	$("#userBtn").attr({"disabled":"disabled"});
		      $(form).ajaxSubmit({
		        type:"post",
		        success: function(data){
		          	if(data.state){
			          parent.ref();
			        }
			         $.messager.alert('保存用户:',data.msg);
		        }
		      });
		  },
          rules:
          {  
			 "name": { required: true },
			 "username": { required: true },
			 "orderby": { required: true,digits:true }
          }
     });
});
</SCRIPT>